From 22bcc5f006e8d68a9ea30b6cf871097b5536b00f Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 9 Aug 2010 16:33:45 +0100 Subject: [PATCH] vt-d: Fix ioapic_rte_to_remap_entry error path. When ioapic_rte_to_remap_entry fails, currently it just writes value to ioapic. But the 'mask' bit may be changed if it writes to the upper half of RTE. This patch ensures to recover the original value of 'mask' bit in this case. Signed-off-by: Weidong Han --- xen/drivers/passthrough/vtd/intremap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 1f9ca0e54c..78587b2c6e 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -440,6 +440,13 @@ void io_apic_write_remap_rte( { *IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg; *(IO_APIC_BASE(apic)+4) = value; + + /* Recover the original value of 'mask' bit */ + if ( rte_upper ) + { + *IO_APIC_BASE(apic) = reg; + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0); + } return; } -- 2.30.2